package com.snow.useviewdemo.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding

/**
 * Created by zhaoyingtao
 * Date: 2020/10/10
 * Describe:kotlin的baseActivity
 */
abstract class BaseKtActivity<T : ViewBinding> : AppCompatActivity() {
    private lateinit var _binding: T
    protected val binding get() = _binding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        _binding = getViewBinding()
        setContentView(_binding.root)
        setViewData(savedInstanceState)
    }

    protected abstract fun getViewBinding(): T
    protected abstract fun setViewData(savedInstanceState: Bundle?)
}